﻿<%@ Page Title="" Language="C#"  MasterPageFile="~/MasterPage/Foreground.Master" AutoEventWireup="true" CodeBehind="AddPics.aspx.cs" Inherits="Planetwork.AddPics" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style>
        .breadcrumb a, a:hover{
           color:black;
           text-decoration:none;
       }
    </style>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <br />
    <ul class="breadcrumb">
        <li><a href="../Home/Home.aspx"><span class="glyphicon glyphicon-home"></span> 首页</a></li>
        <li class="active" >添加图片</li>
    </ul>
    <div class="col-sm-6 col-sm-offset-3 panel panel-default" style="margin-top:20px;background-color:#f7f7f7">
       <div class="panel-heading"><div class="panel-title">
           <p style="font-family:Arial; font-size:30px;color:#858786">添加图片</p>
           <p class="text-left" style="color:#858786">请上传你要分享的图片</p>
       </div></div>
        <div class="panel-body">
            <label style="color:#858786;font-size:15px;">你的名字</label>
            <asp:TextBox ID="name" CssClass="form-control" runat="server" Enabled="false" ></asp:TextBox>
            <br />
             <label style="color:#858786;font-size:15px;">图片的描述</label>
            <asp:TextBox ID="remarks" CssClass="form-control" runat="server" TextMode="MultiLine" Rows="4"></asp:TextBox>
            <br />
             <label style="color:#858786;font-size:15px;">上传图片</label>
            <asp:FileUpload ID="imageUpload" runat="server" CssClass="form-control" />
            <br />
            <img src="" id="img" style="width:500px; height:300px; box-shadow:#f2cf5c;display:none;" />
            <br />
            <br />
            <asp:Button ID="submit" runat="server" CssClass="btn btn-success center-block"  Text="Send" OnClick="submit_Click" />
            
        </div>
    </div>
    <script type="text/javascript">
        //图片上传预览
        function getObjectURL(file) {
	        var url = null ; 
	        if (window.createObjectURL!=undefined) { // basic
		        url = window.createObjectURL(file) ;
	        }
	        else if (window.URL != undefined) { // mozilla(firefox)
		        url = window.URL.createObjectURL(file) ;
	        }
	        else if (window.webkitURL != undefined) { // webkit or chrome
		        url = window.webkitURL.createObjectURL(file) ;
	        }
	        return url ;
        }
        
        $("#ContentPlaceHolder1_imageUpload").change(function () {
            var objUrl = getObjectURL(this.files[0]);
            console.log("objUrl = " + objUrl);
            if (objUrl) {
                $("#img").attr("src", objUrl);
                $("#img").show();
            }
        });
        ////图片上传预览结束 
    </script>
</asp:Content>
